import { request } from "../config/axios.config";

const getTags = async () => {
  return request.get("/post/tags");
};

const getPosts = async (page) => {
  return request.get("/post/list", {
    params: page,
  });
};

const getPostDetail = async (id) => {
  return request.get("/post/detail", {
    params: { id },
  });
};

const postComment = async (id, content) => {
  return request.post(
    "/post/postComment",
    {
      content,
    },
    { params: { id } }
  );
};

const publishPost = async (post) => {
  return request.post("/post/publishPost", post);
};

const index = async (page) => {
  return request.get("/post/index", {
    params: page,
  });
};

export { getTags, getPosts, getPostDetail, postComment, publishPost, index };
